home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Leser 19 / Amiga Plus Leser CD 19.iso / Tools / MorphOS / cvs-1.11.2 / source / amiga / ssh / macros.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-11-18  |  1.4 KB  |  54 lines

  1. /*
  2.  * Common macros for Blowfish, DES and IDEA
  3.  *
  4.  * $Id$
  5.  *
  6.  * :ts=4
  7.  */
  8.  
  9. #ifndef _MACROS_H
  10. #define _MACROS_H
  11.  
  12. /****************************************************************************/
  13.  
  14. #define GET_32BIT_LSB_FIRST(cp) \
  15.   (((unsigned long)(unsigned char)(cp)[0]) | \
  16.   ((unsigned long)(unsigned char)(cp)[1] << 8) | \
  17.   ((unsigned long)(unsigned char)(cp)[2] << 16) | \
  18.   ((unsigned long)(unsigned char)(cp)[3] << 24))
  19.  
  20. #define PUT_32BIT_LSB_FIRST(cp, value) do { \
  21.   (cp)[0] = (value); \
  22.   (cp)[1] = (value) >> 8; \
  23.   (cp)[2] = (value) >> 16; \
  24.   (cp)[3] = (value) >> 24; } while (0)
  25.  
  26. #define GET_32BIT_MSB_FIRST(cp) \
  27.   (((unsigned long)(unsigned char)(cp)[3]) | \
  28.   ((unsigned long)(unsigned char)(cp)[2] << 8) | \
  29.   ((unsigned long)(unsigned char)(cp)[1] << 16) | \
  30.   ((unsigned long)(unsigned char)(cp)[0] << 24))
  31.  
  32. #define PUT_32BIT_MSB_FIRST(cp, value) do { \
  33.   (cp)[3] = (value); \
  34.   (cp)[2] = (value) >> 8; \
  35.   (cp)[1] = (value) >> 16; \
  36.   (cp)[0] = (value) >> 24; } while (0)
  37.  
  38. #define GET_16BIT(cp) (((unsigned long)(unsigned char)(cp)[0] << 8) | \
  39.                ((unsigned long)(unsigned char)(cp)[1]))
  40.  
  41. /****************************************************************************/
  42.  
  43. #ifndef TRUE
  44. #define TRUE (0==0)
  45. #endif /* TRUE */
  46.  
  47. #ifndef FALSE
  48. #define FALSE (0!=0)
  49. #endif /* FALSE */
  50.  
  51. /****************************************************************************/
  52.  
  53. #endif /* _MACROS_H */
  54.